/*
 * @Description: 
 */


import { createRouter,createWebHashHistory} from "vue-router";

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import(/* webpackChunkName: "about" */ '@/views/home/index.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "about" */ '@/views/user/login/index.vue')
  }
]
let router = createRouter({
  history: createWebHashHistory(),
  routes: routes
})

//挂载路由导航守卫
// router.beforeEach((to, from, next) => {
//   if (to.path === "/login") {
//     return next()
//   } else {
//     //获取在登陆时返回数据里面保存在内存中的token值
//     let token = window.localStorage.getItem("token")

//     if (!token) {
//       return next("/login")
//     } else {
//       next()
//     }
//   }
// })

export default router
